// AUTO GENERATED CODE!
// CODE GENERATOR WILL NOT PRESERVE MANUAL CHANGES TO THIS CODE!
// 

// MIT License (MIT)
// 
// Copyright (c) 2014 K Ercan Turkarslan
// 
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
// 
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
// 
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
// 


using System;

namespace Mios.Generated.ServiceFiles
{
    // Generated from S_DigitalSecurityCameraSettings1.xml
    
    public class DigitalSecurityCameraSettings1Service : MiosService
    {
        #region AutomaticWhiteBalance : Boolean;
        private Boolean? _mAutomaticWhiteBalance;
        
        public Boolean AutomaticWhiteBalance
        {
            get
            {
                return _mAutomaticWhiteBalance ?? GetAutomaticWhiteBalance();
            }
        }
        
        #region Action SetAutomaticWhiteBalance(Boolean newAutomaticWhiteBalance) : String;
        public String SetAutomaticWhiteBalance(Boolean newAutomaticWhiteBalance)
        {
            return Engine.Luup_CallAction(base.DeviceId, base.ServiceId, "SetAutomaticWhiteBalance",
                String.Format("NewAutomaticWhiteBalance={0}", ToLuup(_mAutomaticWhiteBalance = newAutomaticWhiteBalance)));
        }
        #endregion Action SetAutomaticWhiteBalance
        
        #region Action GetAutomaticWhiteBalance() : Boolean;
        public Boolean GetAutomaticWhiteBalance()
        {
            _mAutomaticWhiteBalance = FromLuupBoolean(Engine.Luup_VariableGet(base.DeviceId, base.ServiceId, "AutomaticWhiteBalance"));
            
            return _mAutomaticWhiteBalance.Value;
        }
        #endregion Action GetAutomaticWhiteBalance
        
        #endregion
        
        #region FixedWhiteBalance : UInt32;
        private UInt32? _mFixedWhiteBalance;
        
        public UInt32 FixedWhiteBalance
        {
            get
            {
                return _mFixedWhiteBalance ?? GetFixedWhiteBalance();
            }
        }
        
        #region Action SetFixedWhiteBalance(UInt32 newFixedWhiteBalance) : String;
        public String SetFixedWhiteBalance(UInt32 newFixedWhiteBalance)
        {
            if(newFixedWhiteBalance > 10000)
                throw new ArgumentOutOfRangeException("newFixedWhiteBalance");
            
            return Engine.Luup_CallAction(base.DeviceId, base.ServiceId, "SetFixedWhiteBalance",
                String.Format("NewFixedWhiteBalance={0}", ToLuup(_mFixedWhiteBalance = newFixedWhiteBalance)));
        }
        #endregion Action SetFixedWhiteBalance
        
        #region Action GetFixedWhiteBalance() : UInt32;
        public UInt32 GetFixedWhiteBalance()
        {
            _mFixedWhiteBalance = FromLuupUInt32(Engine.Luup_VariableGet(base.DeviceId, base.ServiceId, "FixedWhiteBalance"));
            
            return _mFixedWhiteBalance.Value;
        }
        #endregion Action GetFixedWhiteBalance
        
        #endregion
        
        #region AvailableRotations : String;
        private String _mAvailableRotations;
        
        public String AvailableRotations
        {
            get
            {
                return _mAvailableRotations ?? GetAvailableRotations();
            }
        }
        
        #region Action GetAvailableRotations() : String;
        public String GetAvailableRotations()
        {
            _mAvailableRotations = FromLuupString(Engine.Luup_VariableGet(base.DeviceId, base.ServiceId, "AvailableRotations"));
            
            return _mAvailableRotations;
        }
        #endregion Action GetAvailableRotations
        
        #endregion
        
        #region DefaultRotation : String;
        private String _mDefaultRotation;
        
        public String DefaultRotation
        {
            get
            {
                return _mDefaultRotation ?? GetDefaultRotation();
            }
        }
        
        #region Action SetDefaultRotation(String newRotation) : String;
        public String SetDefaultRotation(String newRotation)
        {
            if (String.IsNullOrEmpty(newRotation))
                throw new ArgumentNullException("newRotation");
            
            return Engine.Luup_CallAction(base.DeviceId, base.ServiceId, "SetDefaultRotation",
                String.Format("NewRotation={0}", ToLuup(_mDefaultRotation = newRotation)));
        }
        #endregion Action SetDefaultRotation
        
        #region Action GetDefaultRotation() : String;
        public String GetDefaultRotation()
        {
            _mDefaultRotation = FromLuupString(Engine.Luup_VariableGet(base.DeviceId, base.ServiceId, "DefaultRotation"));
            
            return _mDefaultRotation;
        }
        #endregion Action GetDefaultRotation
        
        #endregion
        
        #region Brightness : Byte;
        private Byte? _mBrightness;
        
        public Byte Brightness
        {
            get
            {
                return _mBrightness ?? GetBrightness();
            }
        }
        
        #region Action SetBrightness(Byte newBrightness) : String;
        public String SetBrightness(Byte newBrightness)
        {
            if(newBrightness > 100)
                throw new ArgumentOutOfRangeException("newBrightness");
            
            return Engine.Luup_CallAction(base.DeviceId, base.ServiceId, "SetBrightness",
                String.Format("NewBrightness={0}", ToLuup(_mBrightness = newBrightness)));
        }
        #endregion Action SetBrightness
        
        #region Action GetBrightness() : Byte;
        public Byte GetBrightness()
        {
            _mBrightness = FromLuupByte(Engine.Luup_VariableGet(base.DeviceId, base.ServiceId, "Brightness"));
            
            return _mBrightness.Value;
        }
        #endregion Action GetBrightness
        
        #endregion
        
        #region ColorSaturation : Byte;
        private Byte? _mColorSaturation;
        
        public Byte ColorSaturation
        {
            get
            {
                return _mColorSaturation ?? GetColorSaturation();
            }
        }
        
        #region Action SetColorSaturation(Byte newColorSaturation) : String;
        public String SetColorSaturation(Byte newColorSaturation)
        {
            if(newColorSaturation > 100)
                throw new ArgumentOutOfRangeException("newColorSaturation");
            
            return Engine.Luup_CallAction(base.DeviceId, base.ServiceId, "SetColorSaturation",
                String.Format("NewColorSaturation={0}", ToLuup(_mColorSaturation = newColorSaturation)));
        }
        #endregion Action SetColorSaturation
        
        #region Action GetColorSaturation() : Byte;
        public Byte GetColorSaturation()
        {
            _mColorSaturation = FromLuupByte(Engine.Luup_VariableGet(base.DeviceId, base.ServiceId, "ColorSaturation"));
            
            return _mColorSaturation.Value;
        }
        #endregion Action GetColorSaturation
        
        #endregion
        
        
        #region Action IncreaseBrightness()
        public void IncreaseBrightness()
        {
            Engine.Luup_CallAction(base.DeviceId, base.ServiceId, "IncreaseBrightness");
        }
        #endregion Action IncreaseBrightness
        
        #region Action DecreaseBrightness()
        public void DecreaseBrightness()
        {
            Engine.Luup_CallAction(base.DeviceId, base.ServiceId, "DecreaseBrightness");
        }
        #endregion Action DecreaseBrightness
        
        #region Action IncreaseColorSaturation()
        public void IncreaseColorSaturation()
        {
            Engine.Luup_CallAction(base.DeviceId, base.ServiceId, "IncreaseColorSaturation");
        }
        #endregion Action IncreaseColorSaturation
        
        #region Action DecreaseColorSaturation()
        public void DecreaseColorSaturation()
        {
            Engine.Luup_CallAction(base.DeviceId, base.ServiceId, "DecreaseColorSaturation");
        }
        #endregion Action DecreaseColorSaturation
        
        
        #region Method SetVariable(String name, String value) : Boolean;
        internal override Boolean SetVariable(String name, String value)
        {
            switch(name)
            {
                case "AutomaticWhiteBalance":
                    _mAutomaticWhiteBalance = FromLuupBoolean(value); return true;
                case "AvailableRotations":
                    _mAvailableRotations = FromLuupString(value); return true;
                case "Brightness":
                    _mBrightness = FromLuupByte(value); return true;
                case "ColorSaturation":
                    _mColorSaturation = FromLuupByte(value); return true;
                case "DefaultRotation":
                    _mDefaultRotation = FromLuupString(value); return true;
                case "FixedWhiteBalance":
                    _mFixedWhiteBalance = FromLuupUInt32(value); return true;
                default:
                    return false;
            }
        }
        #endregion Method SetVariable
        
        public DigitalSecurityCameraSettings1Service(MiosEngine engine, UInt32 deviceId, String serviceId)
            : base(engine, deviceId, serviceId)
        {
            
        } //End Constructor
    } //End of class
} //End of Namespace

